<!DOCTYPE html>
<html lang="en">
    {%  load static %}
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="{% static 'paginator_study/css/page_style.css' %}">

</head>
<body>
<div>
    <table>
        <tr>
            <th>序号</th>
            <th>学生姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>身份证号</th>
        </tr>
        {% for student in page_obj.object_list %}
            <tr>
                <th>{{ page_obj.start_index|add:forloop.counter0 }}</th>
                <th>{{ student.name }}</th>
                <th>{{ student.age }}</th>
                <th>{{ student.sex }}</th>
                <th>{{ student.card_no }}</th>
            </tr>
        {% endfor %}
    </table>
    <nav>
        <ul>
            <li><a href="?num=1"><span>首页</span></a></li>

            {% if page_obj.has_previous %}
                <li><a href="?num={{ page_obj.previous_page_number }}"><span>上一页</span></a></li>
            {% else %}
                <li><span>上一页</span></li>
            {% endif %}

            {% for page_number in range_list %}
                {% if page_number == page_obj.number %}
                    <li><a href="?num={{ page_number }}"><span><strong>{{ page_number }}</strong></span></a></li>

                {% else %}
                    <li><a href="?num={{ page_number }}"><span>{{ page_number }}</span></a></li>
                {% endif %}
            {% endfor %}

            {% if page_obj.has_next %}
                <li><a href="?num={{ page_obj.next_page_number }}"><span>下一页</span></a></li>
            {% else %}
                <li>下一页</li>
            {% endif %}

            <li><a href="?num={{ paginator_obj.num_pages }}"><span>末页</span></a></li>

            <li>总共{{ paginator_obj.num_pages }}页 当前是第{{ page_obj.number }}页</li>

        </ul>

    </nav>
</div>
</body>
</html>